package net.lanelife.casino.caipiao.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Index;
import javax.persistence.Table;

import net.lanelife.casino.caipiao.entity.support.UserRelationEntity;
import net.lanelife.casino.common.entity.annotation.Checked;
import net.lanelife.casino.common.utils.BillNoUtils;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "TB_RECHARGE_RECORD", indexes = { 
	@Index(name = "IDX_BILLNO", columnList = "BILLNO"),
	@Index(name = "IDX_USER_ID", columnList = "USER_ID"),
	@Index(name = "IDX_USER_NAME", columnList = "USER_NAME"),
	@Index(name = "IDX_FLOOR", columnList = "FLOOR"),
	@Index(name = "IDX_PATH", columnList = "PATH"),
	@Index(name = "IDX_PARENT_ID", columnList = "PARENT_ID"),
	@Index(name = "IDX_PARENT_NAME", columnList = "PARENT_NAME")
})
public class RechargeRecord extends UserRelationEntity<Integer> {

	private static final long serialVersionUID = -4640564658713982003L;

	@Checked
	@Column(name = "BILLNO", length = 24, nullable = false)
	private String billNo = BillNoUtils.generateBillNo(BillNoUtils.PREFIX_CZ);
	
	@Checked
	@Column(name = "AMOUNT", nullable = false)
	private Double amount;
	
	@Checked
	@Column(name = "FEE", nullable = false)
	private Double fee = 0D;
	
	@Checked
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "WAY", nullable = false)
	private Way way;
	
	@Checked
	@Column(name = "PAYER_BANK_NAME", length = 10, nullable = false)
	private String payerBankName;
	
	@Checked
	@Column(name = "PAYER_ACCOUNT_NAME", length = 10, nullable = false)
	private String payerAccountName;
	
	@Checked
	@Column(name = "PAYER_ACCOUNT_NO", length = 20, nullable = false)
	private String payerAccountNo;
	
	@Checked
	@Column(name = "PAYEE_BANK_NAME", length = 10, nullable = false)
	private String payeeBankName;
	
	@Checked
	@Column(name = "PAYEE_ACCOUNT_NAME", length = 10, nullable = false)
	private String payeeAccountName;
	
	@Checked
	@Column(name = "PAYEE_ACCOUNT_NO", length = 20, nullable = false)
	private String payeeAccountNo;
	
	public static enum Way {
		OP, BT
	}
	
	public RechargeRecord() {}
	
	public RechargeRecord(User user) {
		super(user);
	}

	public String getBillNo() {
		return billNo;
	}

	public void setBillNo(String billNo) {
		this.billNo = billNo;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public Double getFee() {
		return fee;
	}

	public void setFee(Double fee) {
		this.fee = fee;
	}

	public Way getWay() {
		return way;
	}

	public void setWay(Way way) {
		this.way = way;
	}

	public String getPayerBankName() {
		return payerBankName;
	}

	public void setPayerBankName(String payerBankName) {
		this.payerBankName = payerBankName;
	}

	public String getPayerAccountName() {
		return payerAccountName;
	}

	public void setPayerAccountName(String payerAccountName) {
		this.payerAccountName = payerAccountName;
	}

	public String getPayerAccountNo() {
		return payerAccountNo;
	}

	public void setPayerAccountNo(String payerAccountNo) {
		this.payerAccountNo = payerAccountNo;
	}

	public String getPayeeBankName() {
		return payeeBankName;
	}

	public void setPayeeBankName(String payeeBankName) {
		this.payeeBankName = payeeBankName;
	}

	public String getPayeeAccountName() {
		return payeeAccountName;
	}

	public void setPayeeAccountName(String payeeAccountName) {
		this.payeeAccountName = payeeAccountName;
	}

	public String getPayeeAccountNo() {
		return payeeAccountNo;
	}

	public void setPayeeAccountNo(String payeeAccountNo) {
		this.payeeAccountNo = payeeAccountNo;
	}


}
